import os
import pandas as pd


class Dataopen:
    def __init__(self, path):
        self.data = pd.read_csv(path)

    def to_list(self):
        return self.data.values.tolist()

    def to_dict(self):
        return [self.data.iloc[i].to_dict() for i in self.data.index.values]


if __name__ == '__main__':
    print(os.path.abspath(__file__))
    print(os.path.dirname(os.path.abspath(__file__)))
    path_pd=(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    print(path_pd)
    path=os.path.join(path_pd,'data/lj_data.csv')
    print(path)
    do = Dataopen(path)
    do.to_dict()
    do.to_list()
